package com.sun.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.sun.config.SentinelConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SentinelController {


    /**
     * 需要明确的几点内容？
     * 1、value=ss 是资源名
     * 2、blockHandlerClass作用的对象是/flow
     * 3、fallback作用的对象是ss
     * @return
     */
    @SentinelResource(value = "ss",blockHandlerClass = SentinelConfiguration.class,fallback = "testFlowRuleFallBack" )
    @RequestMapping("/flow")
    public String testFlowRule() {
        return "hi";
    }

    public String testFlowRuleFallBack(){
        return "fallBack";
    }
}
